from fastapi import FastAPI
from conf.config import settings

def register_static_file(app: FastAPI):
    """
    静态文件交互开发模式, 生产使用 nginx 静态资源服务

    :param app:
    :return:
    """
    if settings.STATIC_FILE:
        import os
        from fastapi.staticfiles import StaticFiles

        # if not os.path.exists("./static"):
        #     os.mkdir("./static")
        app.mount("/static", StaticFiles(directory=settings.STATIC_PATH), name="static")